<template>
  <div class="header">
    <div class="header-left">
      <a href="javascript:;">
        <i class="iconfont icon-fanhui"></i>
      </a>
    </div>
    <div class="header-input">
      <i class="iconfont icon-sousuo"></i>
      <input type="text" class="" placeholder="请输入城市/景点/攻略">
    </div>
    <router-link to="/city">
      <div class="header-right">
        <span>{{this.city}}</span>
        <i class="iconfont icon-jiantouxia arrow-icon"></i>
      </div>
    </router-link>
  </div>
</template>

<script>
  import {mapState} from 'vuex'

  export default {
    name: 'HomeHeader',
    computed: {
      //  mapState 把Vuex里面的数据映射到当前组件的计算属性中
      ...mapState(['city'])
    }
  }
</script>

<style lang="stylus" scoped>
  @import "~styles/varibles.styl"
  .header
    display: flex
    height: 0.86rem
    background: $myBgColor
    font-size: 14px
    color: $whiteColor
    .header-left
      width: 0.64rem
      float: left
      a
        display: block
        margin-top: 0.32rem
        color: $whiteColor
    .header-input
      flex: 1;
      height: 0.64rem
      margin-left: 0.24rem
      margin-top: 0.12rem
      background: $whiteColor
      -webkit-border-radius: 0.1rem
      -moz-border-radius: 0.1rem
      border-radius: 0.1rem
      padding: 0 0.1rem
      position: relative
      i {
        position: absolute
        left: 0.1rem
        top: 0.14rem
        color: #888;
      }
      input {
        display: block
        height: 100%
        padding: 0 0.2rem 0 0.4rem
      }
    .header-right
      min-width: 1.04rem
      padding: 0 .1rem
      float: right
      text-align: right
      color: #fff
      span
        display: block
        margin-top: 0.32rem
        margin-right: 0.4rem
      .arrow-icon {
        display: block
        margin-top: -0.3rem;
        margin-right: 0.05rem;
      }
</style>
